package cn.hotel.service;

import cn.hotel.dao.LogInDao;
import cn.hotel.dao.LogIns;
import cn.hotel.pojo.Administrator;
import cn.hotel.pojo.Log;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class LogInServiceImpl implements LogInService{

    LogIns logIns = new LogInDao();
    @Override
    public Map<String, Object> logIn(String name, String password) {
        Map<String ,Object> logs = new HashMap<>();
        try {
            Administrator administrator = logIns.logIn(name,password);
            if(administrator != null){
                logs.put("flag","1");
                logs.put("mag","查询成功");
                logs.put("data",administrator);
            }else {
                logs.put("flag","0");
                logs.put("mag","查询失败");
            }
        } catch (Exception exception) {
            exception.printStackTrace();
            logs.put("flag","-1");
            logs.put("mag","程序异常");
        }
        return logs;
    }
}
